<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script>
        function onResolved(id){
            setTimeout(console.log,0,id,'resolved')
        }
        function onRejected(id){
            setTimeout(console.log,0,id,'rejected')
        }
        let p1 = new Promise((resolve,reject)=>setTimeout(resolve,3000))
        let p2 = new Promise((resolve,reject)=>setTimeout(reject,3000))
        p1.then('1231232');//非函数会被静默
        p2.then(null,()=>onRejected('p2'));//不传onresolveed的写法unll
        //期约只能转换最终状态一次，两个操作互斥

        //////then()方法只接受函数参数

        let p3=new Promise(()=>{});//executor 未调用 resolve/reject
        //没提供处理程序
        let p4=p3.then();//then里面空,无回调，没有显式的返回语句
        setTimeout(console.log,0,p3);
        setTimeout(console.log,0,p4);
        // let p1 = new Promise((resolve,reject)=>setTimeout(resolve,3000));
        // p1.then(console.log(123))

    </script>
</head>
<body>
    
</body>
</html>